import java.util.Scanner;

public class test {
    public static void main(String[] args){
        //乘法表打印
        for(int i=1;i<=9;i++){
            for(int j=1;j<=i;j++){
                int mul=j*i;
                System.out.printf("%d*%d=%-2d  ",j,i,mul);
            }
            System.out.println();
        }

        //第二种图形打印
        for(int i=1;i<=9;i++) {
            int j=0;
            //打印空格
           for(j=1;j<i;j++){
                System.out.print("          ");
            }
            //打印数据
           for(j=i;j<=9;j++){
               int mul=j*i;
               System.out.printf("%d*%d=%-2d    ",i,j,mul);
            }
           System.out.println();
        }

        //第三种图形打印
        for(int i=1;i<=9;i++) {
            int j=0;
            //打印空格
            for(j=9-i;j>=0;j--){
                System.out.print("     ");
            }
            //打印数据
            for(j=1;j<=i;j++){
                int mul=j*i;
                System.out.printf("%d*%d=%-2d    ",j,i,mul);
            }
            System.out.println();
        }

        //阶乘
       System.out.print("请输入:>");
        Scanner scanner=new Scanner(System.in);
        long n=scanner.nextLong();
        if(n<0||n>21){
            System.out.println("error!");
        }
        else if(n==0){
            System.out.println("0!=1");
        }
        else{
            long i=0L;
            long j=1L;
            for(i=1;i<=n;i++){
                j=j*i;
            }
            System.out.println(n+"!="+j);
        }
        scanner.close();
    }

}
